<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="resources/admin/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script src="resources/admin/jquery/jquery-1.12.4.min.js" type="text/javascript"></script>
    <script src="resources/admin/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="resources/admin/grid/grhtml5-6.6-min.js" type="text/javascript"></script>
    <script src="resources/admin/grid/grwebapp.js" type="text/javascript"></script>
    <script type="text/javascript">
        function window_onload() {
            var reportURL = "../uploadfiles/grf/xmfzbb.grf";
            var dataURL = "../getData1.do?groupid=${groupid}";
            var reportViewer;

            webapp_urlprotocol_startup(); //启动WEB报表客户端程序，以便侦听接受 WebSocket 数据。这句特别重要*：只有在WEB报表客户端程序后，才能进行WebSocket通讯
            //应该还有服务器端确定的方式
            window.rootURL = window.location.protocol + "//" + window.location.host + "/admin/";

            //应该还有服务器端确定的方式
            window.reportURL = reportURL;
            window.dataURL = dataURL;

            reportViewer = window.rubylong.grhtml5.insertReportViewer("report_holder", reportURL, dataURL);

            reportViewer.start(); //启动报表运行，生成报表
        }

        //应用URL协议启动WEB报表客户端程序，根据参数 args 调用对应的功能
        function webapp(args) {
            args.baseurl = window.rootURL;
            args.report = window.reportURL;
            args.data = window.dataURL;

            //webapp_urlprotocol_run(args);
            webapp_ws_run(args);
        }
    </script>
    <style type="text/css">
        #toolbar {
            display: block;
            position: fixed;
            width: 100%;
            height: 40px;
            margin: 0;
            padding: 4px 4px;
            border: solid 1px;
            background-color: #fae3e3;
        }

        #report_holder {
            /*padding-top: 40px;*/
            padding:40px 4px 4px 4px;
            margin: 0,4px,4px,0;
        }

        .rdock {
            position:absolute;
            right:8px;
        }
    </style>
</head>
<body onload="window_onload()">
<div id="toolbar" class="row">
    <a class="btn btn-sm btn-primary" role="button" href='javascript:webapp({});'>打印预览</a>
    <a class="btn btn-sm btn-primary" role="button" href='javascript:webapp({"type":"print"});'>打印...</a>
    <a class="btn btn-sm btn-primary" role="button" href='javascript:webapp({"type":"print","showOptionDlg":"false"});'>直接打印</a>

    <a class="btn btn-sm btn-primary" role="button" href='javascript:webapp({"type":"pdf"});'>导出PDF</a>
    <a class="btn btn-sm btn-primary" role="button" href='javascript:webapp({"type":"xls"});'>导出Excel</a>
    <div class="btn-group btn-group-sm">
        <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">数据导出<span class="caret"></span></button>
        <ul class="dropdown-menu" role="menu">
            <li><a href='javascript:webapp({"type":"pdf"});'>PDF</a></li>
            <li><a href='javascript:webapp({"type":"xls"});'>Excel</a></li>
            <li><a href='javascript:webapp({"type":"rtf"});'>RTF</a></li>
            <li><a href='javascript:webapp({"type":"csv"});'>CSV</a></li>
            <li><a href='javascript:webapp({"type":"txt"});'>文本</a></li>
            <li><a href='javascript:webapp({"type":"img"});'>图像</a></li>
        </ul>
    </div>

    <a class="btn btn-sm btn-primary" role="button" href='javascript:webapp({"type":"grd"});'>生成报表文档</a>
</div>


<div id="report_holder"></div>
</body>
</html>